import 'package:flutter/services.dart';

final netPlatform = MethodChannel("com.mars.huoxingtang/net");

typedef ParseElement<T> = T Function(dynamic element);

Future<String> longLogin(loginToken) async {
  try {
    return await netPlatform.invokeMethod("login",<String, dynamic>{
      'token': loginToken,
    });
  } on PlatformException catch (e) {
    print(e.message);
  }
  return null;
}

Future<String> longLogout() async {
  try {
    return await netPlatform.invokeMethod("logout");
  } on PlatformException catch (e) {
    print(e.message);
  }
  return null;
}
